
    <!DOCTYPE html>
    <html lang="zh-CN">
    <head>
      <meta charset="UTF-8">
      <meta name="viewport" content="width=device-width, initial-scale=1.0">
      <title>RocketMQ与Kafka对比 - 学习卡片</title>
      <style>
        body { font-family: sans-serif; background-color: #f0f8ff; color: #333; display: flex; flex-direction: column; align-items: center; padding: 50px 20px; }
        .header h1 { font-size: 32px; }
        .grid-container { display: grid; grid-template-columns: repeat(3, 1fr); gap: 28px; width: 100%; max-width: 1200px; }
        .card-container { perspective: 1200px; cursor: pointer; height: 250px; }
        .card { width: 100%; height: 100%; position: relative; transform-style: preserve-3d; transition: transform 0.7s; border-radius: 16px; box-shadow: 0 4px 16px rgba(0,0,0,0.08); }
        .card-container.flipped .card { transform: rotateY(180deg); }
        .card-face { position: absolute; width: 100%; height: 100%; backface-visibility: hidden; display: flex; flex-direction: column; box-sizing: border-box; border-radius: 16px; background-color: #fff; padding: 24px; }
        .card-back { background-color: #f0fff4; transform: rotateY(180deg); justify-content: space-between; }
        .card-category { font-size: 14px; color: #0052d9; margin-bottom: 8px; font-weight: 500; }
        .card-question { font-size: 20px; font-weight: 500; flex-grow: 1; display: flex; align-items: center; justify-content: center; text-align: center; }
        .card-answer-wrapper { flex-grow: 1; overflow-y: auto; }
        .card-answer { font-size: 15px; line-height: 1.7; }
        .card-footer { font-size: 13px; color: #8a919f; border-top: 1px solid #f0f0f0; padding-top: 16px; margin-top: 16px; }
        .card-source { font-size: 13px; color: #8a919f; border-top: 1px solid #f0f0f0; padding-top: 12px; margin-top: 12px; }
      </style>
    </head>
    <body>
      <div class="header">
        <h1>RocketMQ与Kafka对比 - 学习卡片</h1>
      </div>
      <div class="grid-container">
        
    <div class="card-container" onclick="this.classList.toggle('flipped');">
      <div class="card">
        <div class="card-face card-front">
          <div class="card-category">架构</div>
          <div class="card-question">在RocketMQ的架构中，NameServer扮演什么角色？它与其他NameServer节点的关系是怎样的？</div>
          <div class="card-footer">点击卡片查看答案</div>
        </div>
        <div class="card-face card-back">
          <div class="card-category">架构</div>
          <div class="card-answer-wrapper">
            <div class="card-answer">NameServer是轻量级的服务发现和路由注册中心。其设计特点是各个NameServer节点之间互不通信，是无状态的设计。</div>
          </div>
          <div class="card-source">来源: 核心架构组件 和 集群架构差异</div>
        </div>
      </div>
    </div>

    <div class="card-container" onclick="this.classList.toggle('flipped');">
      <div class="card">
        <div class="card-face card-front">
          <div class="card-category">架构</div>
          <div class="card-question">RocketMQ和Kafka在消息存储的物理模型上有何核心区别？</div>
          <div class="card-footer">点击卡片查看答案</div>
        </div>
        <div class="card-face card-back">
          <div class="card-category">架构</div>
          <div class="card-answer-wrapper">
            <div class="card-answer">RocketMQ采用“CommitLog + ConsumeQueue”结构，所有Topic的消息混合顺序写入同一个CommitLog文件，物理上不隔离。而Kafka以分区(Partition)为存储单元，不同Topic的不同分区对应独立的物理文件夹，消息在物理上是隔离的。</div>
          </div>
          <div class="card-source">来源: 存储架构差异</div>
        </div>
      </div>
    </div>

    <div class="card-container" onclick="this.classList.toggle('flipped');">
      <div class="card">
        <div class="card-face card-front">
          <div class="card-category">架构</div>
          <div class="card-question">RocketMQ和Kafka的集群高可用模型分别是什么？</div>
          <div class="card-footer">点击卡片查看答案</div>
        </div>
        <div class="card-face card-back">
          <div class="card-category">架构</div>
          <div class="card-answer-wrapper">
            <div class="card-answer">RocketMQ采用主从架构（Master-Slave），每个Broker主节点可以配置多个从节点。而Kafka采用分区级别的Leader-Follower架构，每个分区有一个Leader副本和多个Follower副本。</div>
          </div>
          <div class="card-source">来源: 集群架构差异</div>
        </div>
      </div>
    </div>

    <div class="card-container" onclick="this.classList.toggle('flipped');">
      <div class="card">
        <div class="card-face card-front">
          <div class="card-category">特性</div>
          <div class="card-question">RocketMQ原生支持哪些Kafka不原生支持的重要消息类型？</div>
          <div class="card-footer">点击卡片查看答案</div>
        </div>
        <div class="card-face card-back">
          <div class="card-category">特性</div>
          <div class="card-answer-wrapper">
            <div class="card-answer">RocketMQ原生支持顺序消息（全局顺序和分区顺序）、延时消息（最长40天）和更完善的事务消息。而Kafka不原生支持延时消息和顺序消息，需要通过特殊设计实现。</div>
          </div>
          <div class="card-source">来源: 消息类型支持</div>
        </div>
      </div>
    </div>

    <div class="card-container" onclick="this.classList.toggle('flipped');">
      <div class="card">
        <div class="card-face card-front">
          <div class="card-category">特性</div>
          <div class="card-question">Kafka有哪些特有的高级功能，使其在数据处理和生态集成方面具有优势？</div>
          <div class="card-footer">点击卡片查看答案</div>
        </div>
        <div class="card-face card-back">
          <div class="card-category">特性</div>
          <div class="card-answer-wrapper">
            <div class="card-answer">Kafka的特有高级功能包括：通过Kafka Streams提供流处理能力、通过Connect API简化数据导入导出、日志压缩（Log Compaction）特性以及精确一次语义（Exactly Once Semantics）。</div>
          </div>
          <div class="card-source">来源: 高级特性对比</div>
        </div>
      </div>
    </div>

    <div class="card-container" onclick="this.classList.toggle('flipped');">
      <div class="card">
        <div class="card-face card-front">
          <div class="card-category">机制</div>
          <div class="card-question">当消息消费失败时，RocketMQ提供了哪些内置机制来处理这种情况？</div>
          <div class="card-footer">点击卡片查看答案</div>
        </div>
        <div class="card-face card-back">
          <div class="card-category">机制</div>
          <div class="card-answer-wrapper">
            <div class="card-answer">RocketMQ提供了完善的消息异常处理机制，包括消费重试机制（最多重试16次）和死信队列机制，用于处理和存储无法正常消费的异常消息。</div>
          </div>
          <div class="card-source">来源: 消费模式与消费者管理 和 高级特性对比</div>
        </div>
      </div>
    </div>

    <div class="card-container" onclick="this.classList.toggle('flipped');">
      <div class="card">
        <div class="card-face card-front">
          <div class="card-category">对比</div>
          <div class="card-question">在消息消费模式上，RocketMQ与Kafka的主要差异是什么？</div>
          <div class="card-footer">点击卡片查看答案</div>
        </div>
        <div class="card-face card-back">
          <div class="card-category">对比</div>
          <div class="card-answer-wrapper">
            <div class="card-answer">RocketMQ同时支持Push和Pull两种消费方式（其中Push本质是基于长轮询实现的），为消费者提供了更多选择。而Kafka只支持消费者主动的Pull方式消费。</div>
          </div>
          <div class="card-source">来源: 消息传递模型差异</div>
        </div>
      </div>
    </div>

    <div class="card-container" onclick="this.classList.toggle('flipped');">
      <div class="card">
        <div class="card-face card-front">
          <div class="card-category">对比</div>
          <div class="card-question">在性能方面，Kafka和RocketMQ各自更擅长处理哪种场景？</div>
          <div class="card-footer">点击卡片查看答案</div>
        </div>
        <div class="card-face card-back">
          <div class="card-category">对比</div>
          <div class="card-answer-wrapper">
            <div class="card-answer">Kafka在大数据量、高吞吐场景下表现更优，更注重吞吐量。而RocketMQ在低延迟场景下表现更好，更适合对消息投递实时性要求较高的业务。</div>
          </div>
          <div class="card-source">来源: 性能对比</div>
        </div>
      </div>
    </div>

    <div class="card-container" onclick="this.classList.toggle('flipped');">
      <div class="card">
        <div class="card-face card-front">
          <div class="card-category">应用</div>
          <div class="card-question">根据文档建议，金融支付系统和日志收集系统分别更适合选择哪款消息队列，为什么？</div>
          <div class="card-footer">点击卡片查看答案</div>
        </div>
        <div class="card-face card-back">
          <div class="card-category">应用</div>
          <div class="card-answer-wrapper">
            <div class="card-answer">金融支付系统更适合选择RocketMQ，因为它支持事务消息和高可靠性。日志收集系统更适合选择Kafka，因为它在高吞吐、大数据量场景下表现更优。</div>
          </div>
          <div class="card-source">来源: 适用场景</div>
        </div>
      </div>
    </div>

      </div>
    </body>
    </html>
